package perf.store;

import java.util.List;

import perf.data.Binary;
import perf.data.Run;

import com.db4o.ObjectContainer;
import com.db4o.query.Predicate;

public class ObjectList {

	private ObjectContainer db;
	
	public ObjectList( ObjectContainer db ) {
		this.db = db;
	}
	
	@SuppressWarnings("serial")
	public List<Run> runs( ) {
		 return db.query( new Predicate<Run>() {
			 public boolean match(Run run) {
				 return true;
			 }
		 });
	}
	
	@SuppressWarnings("serial")
	public List<Binary> bins( final String runName ) {
		return db.query( new Predicate<Binary>() { 
			public boolean match( Binary bin ) {
				if (bin.getParent().getName().equals( runName ) ) {
					return true;
				} else {
					return false;
				}
			}
		});
	}
}
